package com.horizon.mobile.adapter;

import java.util.List;

import android.app.Activity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.horizon.mobile.R;
import com.horizon.mobile.model.SearchUser;

public class SearchUserListAdapter extends BaseAdapter {

	private List<SearchUser> userList;
	private LayoutInflater inflater;
	private Holder holder;
	private Activity context;

	public SearchUserListAdapter(Activity context, List<SearchUser> userList) {
		inflater = LayoutInflater.from(context);
		this.context = context;
		this.userList = userList;
	}


	private static class Holder {
		TextView title;
		TextView status;
	}

	@Override
	public int getCount() {
		if(userList==null){
			return 0;
		}
		return userList.size();
	}

	@Override
	public Object getItem(int position) {
		return userList.get(position);
	}

	@Override
	public long getItemId(int position) {
		return position;
	}

	@Override
	public View getView(final int position, View convertView, ViewGroup parent) {
		// if(null == convertView) {
		holder = new Holder();
		convertView = inflater.inflate(R.layout.search_history, null);

		holder.title = (TextView) convertView.findViewById(R.id.text1);
		holder.title.setText(userList.get(position).getName());
		return convertView;
	}

}
